home *** CD-ROM | disk | FTP | other *** search
/ Nothing but Tetris / Nothing but Tetris.iso / tools / amiga / twinopus / dopus / reread.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-07-10  |  2.1 KB  |  93 lines

  1. /*
  2.  *
  3.  * Reread current directory with TwinExpress from DOpus.
  4.  *
  5.  * (c) 1994 by K.P. van Beem (2:280/464.2, patrick.van.beem@aobh.xs4all.nl)
  6.  *
  7.  * Based on the DOpusLhaARexx package by Geoff Seeley (but you can better
  8.  * use GuiArc in stead of DOpus and a script, to deal with archives)
  9.  *
  10.  *    Mods  By Ray Abram
  11.  *    - Caching
  12.  *       - checks if the caching file is there, and if it is, then delete it...
  13.  *
  14.  *     - If called on a DOpus Dir, then will tell Dopus to do a ReScan of the Dir
  15.  */
  16.  
  17. trace ?R
  18.  
  19. DOpusPort   = 'DOPUS.1'
  20.  
  21. if ~show(l,"rexxsupport.library") then        
  22.     call addlib("rexxsupport.library",0,-30,0)
  23. if showlist('Ports', DOpusPort) = 0 then do
  24.    say 'Directory Opus Arexx port not found. Aborting.'
  25.    exit
  26. end
  27.  
  28. address 'DOPUS.1'
  29. options results
  30.  
  31. /* Check for a DOpus directory */
  32. 'Status 6 -1'
  33. GetEntry Result
  34. FilePath = Result
  35. if left(FilePath,1) ~= '*' then do
  36.    Rescan
  37.    Busy off
  38.    exit
  39. end
  40.  
  41.  
  42. FilePath = SubStr(FilePath,2)
  43.  
  44. /* convert path to filename */
  45. Cache = 'TwinDirs:' || ConvertFilename(FilePath)
  46.  
  47. /* check for the dir already stored in ram: and delete it if found*/
  48. if exists(Cache) then
  49.    address COMMAND "Delete >NIL:" Quote(Cache)
  50.  
  51. address AREXX "Rexx:DOpus/ReadDir.rexx" FilePath
  52.  
  53. exit
  54.  
  55. /*--------------------------------------------------------------------------*/
  56.  
  57. /* convert a file name from df0:ray/was/here  ->  df0=ray\was\here
  58.                                     then to   ->  d0=ry\ws\he      (cache filename)*/
  59. ConvertFilename: procedure
  60.  
  61.    parse arg Dev ':' Path
  62.  
  63.    if left(dev,1) = '~' then
  64.       dev = '`' || right(dev,length(dev)-1)
  65.  
  66.    t2 = ''
  67.    Convert = ''
  68.    do until (t2 = '')
  69.        parse var Path t1 '/' t2
  70.        Path = t2
  71.        if t2 ~= '' then
  72.          end = '\'
  73.        else
  74.          end = ''
  75.        Convert = Convert || left(t1,1) || right(t1,1) || end
  76.    end
  77.  
  78.    if left(Convert,1) = ' ' then
  79.       Convert = ''
  80.  
  81.    out = Dev || '=' || Convert
  82.  
  83. return out
  84.  
  85. /*--------------------------------------------------------------------------*/
  86.  
  87. /* add quotes to string */
  88. Quote: procedure
  89.    parse arg string
  90. return '"'||string||'"'
  91.  
  92. /*--------------------------------------------------------------------------*/
  93.